{% extends 'admin/common/base.html' %}
{% block css %}
{{super()}}
<link href="{{url_for('admin.static',filename='ajax/libs/jasny/jasny-bootstrap.min.css')}}?v=3.1.3" rel="stylesheet"/>
<link href="{{url_for('admin.static',filename='ajax/libs/summernote/summernote.css')}}" rel="stylesheet"/>
<link href="{{url_for('admin.static',filename='ajax/libs/summernote/summernote-bs3.css')}}" rel="stylesheet"/>
<link href="{{url_for('admin.static',filename='ajax/libs/datapicker/bootstrap-datetimepicker.min.css')}}" rel="stylesheet"/>
{% endblock %}
{% block body %}
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form">
            <input type="hidden" name="id" value="{{d.id}}">
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">模块标题：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="title" id="title" value="{{d.title}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">方法名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="method" id="method" value="{{d.method}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">请求URL：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="oper_url" id="oper_url" value="{{d.oper_url}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">请求方式：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="request_method" id="request_method" value="{{d.request_method}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">请求参数：</label>
				<div class="col-sm-8">
                    <textarea id="oper_param" name="oper_param" class="summernote">{{d.oper_param}}</textarea>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">返回参数：</label>
				<div class="col-sm-8">
                    <textarea id="json_result" name="json_result" class="summernote">{{d.json_result}}</textarea>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">操作人员：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="oper_name" id="oper_name" value="{{d.oper_name}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">主机地址：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="ipaddr" id="ipaddr" value="{{d.ipaddr}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">操作地点：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="login_location" id="login_location" value="{{d.login_location}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">浏览器类型：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="browser" id="browser" value="{{d.browser}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">操作系统：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="ossystem" id="ossystem" value="{{d.ossystem}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">操作状态：</label>
				<div class="col-sm-8">
                    <select id="state" name="state" class="form-control m-b">
						{% for dd in get_dict_data('sys_optlog_state')%}
						<option value="{{dd.value}}" {{'selected' if d.state == dd.value else '' }}>{{dd.label}}</option>
						{% endfor %}
					</select>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">提示消息：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="msg" id="msg" value="{{d.msg}}" required>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">访问时间：</label>
				<div class="col-sm-8">
                    <div class="input-group date">
                        <input name="oper_time" class="form-control dtp" placeholder="yyyy-MM-dd" type="text" value="{{d.oper_time}}" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
				</div>
			</div>
		</form>
	</div>
</body>
{% endblock %}
{% block js %}
{{ super() }}
<script src="{{url_for('admin.static',filename='ajax/libs/jasny/jasny-bootstrap.min.js')}}?v=3.1.3"></script>
<script src="{{url_for('admin.static',filename='ajax/libs/summernote/summernote.min.js')}}"></script>
<script src="{{url_for('admin.static',filename='ajax/libs/summernote/summernote-zh-CN.js')}}"></script>
<script src="{{url_for('admin.static',filename='ajax/libs/datapicker/bootstrap-datetimepicker.min.js')}}"></script>
<script type="text/javascript">

    $(".dtp").datetimepicker({
        format: 'yyyy-mm-dd',
        minView: "month",
        todayBtn:  true,
        autoclose: true,
    })

    $(document).ready(function(){
        $('.summernote').summernote({
            lang: 'zh-CN'
        });
    });
    
    $("#form").validate({

    });
    
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save("{{url_for('admin.sys.optlog.edit')}}", $('#form').serialize());
        }
    }

</script>
{% endblock %}
